#include <stdio.h>
#include <stdlib.h>
#include <string.h>


void display_buf(void* buf, size_t size)
{
    unsigned char* addr = buf;
    int i;
    for(i=0; i<size; i++)
    {
        printf("0x%x ", addr[i]);
    }
    printf("\n");


}


int main()
{
    void* addr = malloc(10);
    memset(addr, 0, 10);

    *(int*)(addr+1) = 0x12345678;
    display_buf(addr, 10);

    int x = 0x12345678;

    memset(addr, 0, 10);
    memcpy(addr+1, &x, sizeof(int)); 
    
    display_buf(addr, 10);

    return 0;
};
